package com.mlk.car.api;

import com.mlk.car.service.EngCarService;
import com.mlk.core.component.page.Pager;
import com.mlk.core.util.ServerResponse;
import com.mlk.engSystem.po.EngSysEmp;
import com.mlk.engSystem.service.EngSysEmpService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/car/log")
public class CarLogAPI {

    @Resource
    private EngCarService engCarService;

    @Resource
    private EngSysEmpService engSysEmpService;

    /**
     * 判断当前人是否有车辆绑定关系
     * @return
     */
    @GetMapping("checkOwnCar")
    public ServerResponse checkOwnCar(String openId){
        return this.engCarService.checkOwnCar(openId);
    }

    /**
     * 获取违规信息列表内容
     * @return
     */
    @GetMapping("logList")
    public Pager carLog(String openId){
        EngSysEmp emp = this.engSysEmpService.getEmpByOpenId(openId);
        return this.engCarService.listPageLog(emp.getCarId());
    }
}
